package com.example.myapplication.chap02;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.example.myapplication.R;

public class Second extends AppCompatActivity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_02_second);
        Intent in = getIntent();
        Bundle b = in.getExtras();
        String s = b.getString("cake");
        TextView tv = findViewById(R.id.text_second);
        tv.setText("收到 : "+s);
        Log.v("Second",s);

        Button bb = findViewById(R.id.button_close);
        bb.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent in = new Intent();
                in.putExtra("re","1234567890");
                setResult(3000,in);
                finish();
            }
        });
    }
}
